Semiconductor memory device and method of controlling the same

ABSTRACT

A semiconductor memory device includes a plurality of detecting code generators configured to generate a plurality of detecting codes to detect errors in a plurality of data items, respectively, a plurality of first correcting code generators configured to generate a plurality of first correcting codes to correct errors in a plurality of first data blocks, respectively, each of the first data blocks containing one of the data items and a corresponding detecting code, a second correcting code generators configured to generate a second correcting code to correct errors in a second data block, the second data block containing the first data blocks, and a semiconductor memory configured to nonvolatilely store the second data block, the first correcting codes, and the second correcting code.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a continuation of and claims the benefit of priorityunder 35 U.S.C. §120 from U.S. Ser. No. 13/090,539 filed Apr. 20, 2011,which is a continuation of U.S. Ser. No. 12/404,861 filed Mar. 16, 2009(now U.S. Pat. No. 8,117,517 issued Feb. 14, 2012), which is acontinuation of PCT Application No. PCT/JP08/063344 filed Jul. 17, 2008,which was published under PCT Article 21(2) in Japanese.

U.S. Ser. No. 13/090,539 filed Apr. 20, 2011, claims the benefit ofpriority from Japanese Patent Application No. 2007-225996 filed Aug. 31,2007, the entire contents of which are incorporated herein by reference.

BACKGROUND OF THE INVENTION

1. Field of the Invention

The present invention relates to a semiconductor memory device and amethod of controlling the same and, for example, to a memory devicewhich nonvolatilely stores information and has an error correctioncircuit, and a method of controlling the memory device.

2. Description of the Related Art

In some kinds of nonvolatile memory devices, the state of the physicalquantity that controls data storage changes along with the elapse oftime. If the elapsed time has reached a predetermined length, the datamay be lost. There are various types of memory devices having such acharacteristic feature. One of such memory devices is, e.g., anonvolatile semiconductor memory device which uses transistors having aso-called laminated gate structure as memory cells.

The laminated gate structure includes a tunnel insulating film, floatinggate electrode, inter-electrode insulating film, and control gateelectrode which are sequentially stacked on a substrate. To storeinformation in a memory cell, electrons are injected from the substrateto the floating gate electrode through the tunnel insulating film. Theelectric charges accumulated in the floating gate electrode retaininformation. The electric charges accumulated in the floating gateelectrode leak to the substrate through the tunnel insulating film asthe time elapses. For this reason, the information retained in thememory cell can be lost along with the elapse of time (an error canoccur in the information).

If the elapsed time from the information storage time is short, an errorcan rarely occur in the information. On the other hand, if a long timehas elapsed after information storage, an error may occur in theinformation at a high probability. A memory device having a plurality ofsuch memory cells sometimes includes an error correction mechanism forrestoring erroneous information to a correct state.

Generally, to correct a number of errors which are contained in dataformed from a plurality of bits due to, e.g., the elapse of time frominformation recording, a correction mechanism having a high errorcorrection capability is necessary. A correction mechanism with a higherror correction capability has a large circuit scale and requires highpower consumption and a long time for processing. Normally, to guaranteeto restore correct information even after the elapse of a long time frominformation storage, a memory device uses a correction mechanism havinga high error correction capability. The high-performance errorcorrection mechanism is applied equally regardless of the length of theelapsed time from information storage.

For this reason, even in reading information which has been stored foronly a short time, the high-performance error correction mechanism isused. Since the information to be read contains not so many errors, theuse of the high-performance error correction mechanism is wasteful. Thisleads to a waste of power in the memory device.

To increase the error correction capability, generally, the size of theerror correction target information needs to be large. For example, anerror-correcting code is generated not for 512-byte data but for, e.g.,4-kbyte data obtained by concatenating a plurality of 512-byte data.This increases the error correction capability. In this method, however,it is necessary to always read out 4-kbyte data even in reading out512-byte data. This also results in a waste of power in the memorydevice.

Prior-art reference information related to this application is

JP-A 63-275225 (KOKAI)

In the reference, a correction apparatus which has a high errorcorrection capability is disclosed.

BRIEF SUMMARY OF THE INVENTION

According to an aspect of the present invention, there is provided asemiconductor memory device comprising: a plurality of detecting codegenerators configured to generate a plurality of detecting codes todetect errors in a plurality of data items, respectively; a plurality offirst correcting code generators configured to generate a plurality offirst correcting codes to correct errors in a plurality of first datablocks, respectively, each of the first data blocks containing one ofthe data items and a corresponding detecting code; a second correctingcode generators configured to generate a second correcting code tocorrect errors in a second data block, the second data block containingthe first data blocks; and a semiconductor memory configured tononvolatilely store the second data block, the first correcting codes,and the second correcting code.

According to an aspect of the present invention, there is provided asemiconductor memory device comprising: A method of controlling asemiconductor memory device, the method comprising: generating aplurality of detecting codes to detect errors in a plurality of dataitems, respectively; generating a plurality of first correcting codes tocorrect errors in a plurality of first data block, respectively, each ofthe first data blocks containing one of the data items and acorresponding detecting code; generating a second correcting code tocorrect errors in a second data block, the second data block containingthe first data blocks; and nonvolatilely storing the second data block,the first correcting codes, and the second correcting code.

BRIEF DESCRIPTION OF THE SEVERAL VIEWS OF THE DRAWING

FIG. 1 is a block diagram schematically illustrating a semiconductormemory device according to an embodiment;

FIG. 2 is a block diagram illustrating the main portion of an errorcorrection circuit associated with data write;

FIG. 3 is a view illustrating a data state in a temporary storagecircuit 3 in write;

FIG. 4 is a view illustrating a state following FIG. 3;

FIG. 5 is a view illustrating a state following FIG. 4;

FIG. 6 is a block diagram illustrating the main portion of the errorcorrection circuit associated with data read;

FIG. 7 is a view illustrating an example of the operation of a seconderror correction unit;

FIG. 8 is a graph illustrating the relationship between the necessarycorrection capability and the elapsed time from write;

FIG. 9 is a view illustrating the concept of the process range of afirst error correction unit 11 and that of the second error correctionunit 13;

FIG. 10 is a graph illustrating the relationship between the error rateand the use probability of the second error correction unit; and

FIG. 11 is a graph illustrating the relationship between the error rateand averaged Chien search of the second error correction unit.

DETAILED DESCRIPTION OF THE INVENTION

An embodiment of the present invention will now be described withreference to the accompanying drawing.

In the following description, the same reference numerals denoteconstituent elements having almost the same functions and arrangements,and a repetitive explanation will be made only when necessary.

The embodiments to be described below are mere examples of an apparatusor method to embody the technical scope of the present invention. Thetechnical scope of the present invention does not limit the materials,shapes, structures, and arrangements of the components to thosedescribed below. The technical scope of the present invention allowsvarious changes and modifications in the appended claims.

The functional blocks of the embodiments of the present invention can beimplemented by hardware, computer software, or a combination thereof.The blocks will be described below generally from the viewpoint of theirfunctions while clarifying that they can be implemented by both ofhardware and software. Whether to execute a function as hardware orsoftware depends on the specific embodiments or design restrictions onthe entire system. Those skilled in the art can implement the functionby various methods for each of the specific embodiments, and the presentinvention incorporates such implementation.

FIG. 1 is a block diagram schematically illustrating a semiconductormemory device according to an embodiment.

As shown in FIG. 1, a semiconductor memory device 10 includes an errorcorrection circuit 1 and a semiconductor memory 2. The error correctioncircuit 1 and the semiconductor memory 2 are formed as, e.g., onesemiconductor integrated circuit on a single semiconductor chip. Thesemiconductor memory 2 can be any memory device if it can nonvolatilelystore information, and the stored data can be changed. An example of thesemiconductor memory 2 is a NAND flash memory.

A NAND flash memory has a plurality of memory cells. Each memory cell isformed from a MOSFET (metal oxide semiconductor field effect transistor)having a so-called laminated gate structure. A MOS transistor with thelaminated gate structure includes a tunnel insulating film, floatinggate electrode, inter-electrode insulating film, control gate electrode,and source and drain diffusion layers. The threshold voltage of eachmemory cell transistor is changed in accordance with the amount ofelectric charge accumulated in the floating gate electrode, and eachmemory cell transistor stores information corresponding to the change inthe threshold voltage. The memory cell transistor can be designed tostore either 1-bit information or information of a plurality of bits. Acontrol circuit including a sense amplifier and a potential generationcircuit in the semiconductor memory 2 can write data supplied to thesemiconductor memory 2 in the memory cell transistors, or output datastored in the memory cell transistor outside the semiconductor memory 2.

The control gate electrodes of memory cell transistors belonging to thesame row are connected to a single word line. A select gate transistoris provided at each of the ends of memory cell transistors which belongto the same column and are connected in series. One select gatetransistor is connected to a bit line. Based on this rule, the memorycell transistors, select gate transistors, word lines, and bit lines areprovided. Data write and read are done for each set of a plurality ofmemory cell transistors. A storage area formed from a set of memory celltransistors corresponds to one page. A plurality of pages form a block.The NAND flash memory erases data in each block.

Data (write data) required to be written in the semiconductor memory 2is externally supplied to the semiconductor memory device 10. The errorcorrection circuit 1 adds an error-correcting code and anerror-detecting code to the write data and supplies it to thesemiconductor memory 2. The semiconductor memory 2 stores the write datawith the error-correcting code and the error-detecting code.

In response to a control signal supplied to the semiconductor memorydevice 10, the semiconductor memory 2 supplies data (read data) requiredto be read, and an error-correcting code and an error-detecting codeadded to the read data to the error correction circuit 1. The errorcorrection circuit 1 detects and corrects an error in the read data. Ifan error exists, the error correction circuit 1 corrects it, removes theerror-correcting code and the error-detecting code, and outputs the readdata to an external device.

[Arrangement of Write System Circuit]

FIG. 2 is a block diagram illustrating the main portion of the errorcorrection circuit 1 associated with data write. The error correctioncircuit 1 generates an error-correcting code for each of a plurality ofwrite data each having a predetermined size and also generates anothererror-correcting code for the set of plurality of write data. The numberof write data is decided in accordance with the error correctioncapability desired to achieve and the error-correcting codes to beemployed. An example in which the number of write data is 8 will bedescribed below.

As shown in FIG. 2, the error correction circuit 1 receives write dataitems Da1 to Da8. The first size can match, e.g., the size of write orread data of the semiconductor memory 2. More specifically, when a NANDflash memory is used as the semiconductor memory 2, the write data sizecorresponds to the size of one page, which is, e.g., 512 bytes. In thefollowing example, the first size is 512 bytes, for descriptiveconvenience.

The error correction circuit 1 has a temporary storage circuit 3. Thetemporary storage circuit 3 is formed from, e.g., a volatile storagecircuit and can be, e.g., a DRAM (dynamic random access memory). Thetemporary storage circuit 3 serves as a temporary storage area in writewhen generating an error-detecting code and an error-correcting code forwrite data to the semiconductor memory 2. In write, the temporarystorage circuit 3 receives the write data items Da1 to Da8. Thetemporary storage circuit 3 stores the write data items Da1 to Da8.

The write data items Da1 to Da8 are supplied to error-detecting codegeneration units 41 to 48 (some are not illustrated), respectively.

The error-detecting code generation units 41 to 48 generate (data of)error-detecting codes Db1 to Db8 for the write data items Da1 to Da8,respectively. The error-detecting codes Db1 to Db8 are used to detecterrors in the write data items Da1 to Da8. A code that allows theerror-detecting code generation units to easily calculate codes andreduce the power consumption while achieving the above-described objectis used as the error-detecting codes Db1 to Db8. For example, CRC(Cyclic Redundancy Checksum) 32 or CRC16 is usable as theerror-detecting code. The error-detecting codes Db1 to Db8 are suppliedto the temporary storage circuit 3.

The error-detecting codes Db1 to Db8 are also supplied to firsterror-correcting code generation units 61 to 68, respectively. The firsterror-correcting code generation units 61 to 68 also receive the writedata items Da1 to Da8, respectively.

The first error-correcting code generation units 61 to 68 generate firsterror-correcting codes using the write data items Da1 to Da8 and theerror-detecting codes Db1 to Db8. The first error-correcting codegenerated by the first error-correcting code generation unit 61 is usedto correct errors in the write data item Da1 and the error-detectingcode data Db1. Similarly, the first error-correcting codes generated bythe first error-correcting code generation units 62 to 68 are used tocorrect errors in the write data items Da2 to Da8 and theerror-detecting code data Db2 to Db8.

As the first error-correcting code, for example, a code which has arelatively low error correction capability of about 1 bit, requires nohigh power and no long time for calculation, and needs only a smallscale circuit for execution is usable. More specifically, for example, aHamming code is usable as the first error-correcting code.

The first error-correcting code generation units 61 to 68 output (dataof) first error-correcting codes Dc1 to Dc8, respectively. The firsterror-correcting codes Dc1 to Dc8 are supplied to the temporary storagecircuit 3.

The error-detecting codes Db1 to Db8 are supplied to a seconderror-correcting code generation unit 8. The second error-correctingcode generation unit 8 also receives the write data items Da1 to Da8.The second error-correcting code generation unit 8 generates a seconderror-correcting code using the write data items Da1 to Da8 and theerror-detecting codes Db1 to Db8. The second error-correcting code isused to correct errors in the write data items Da1 to Da8 and theerror-detecting codes Db1 to Db8.

As the second error-correcting code, for example, a code which enableserror correction at a higher capability than the error correction usingthe first error-correcting code and can correct errors of multiple bits,although the calculation amount is large, is usable. More specifically,for example, a BHC code, Reed-Solomon (RS) code, or LDPC (Low DensityParity Check) code is usable as the second error-correcting code. Thecircuit scale, power consumption, and calculation time of the seconderror-correcting code generation unit 8 exceed those of the firsterror-correcting code generation units 61 to 68 because of the largecalculation amount. However, the second error-correcting code generationunit 8 has a higher error correction capability than the firsterror-correcting code generation units 61 to 68.

The second error-correcting code generation unit 8 supplies (data of) asecond error-correcting code Dd to the temporary storage circuit 3. Thetemporary storage circuit 3 supplies, to the semiconductor memory 2, thewrite data items Da1 to Da8, error-detecting codes Db1 to Db8, firsterror-correcting codes Dc1 to Dc8, and second error-correcting code Dd,which have structures to be described later.

[Operation in Data Write]

The operation of the error correction circuit 1 in data write will bedescribed next with reference to FIGS. 3 to 6. FIGS. 3 to 6schematically show data states in the temporary storage circuit 3 inwrite sequentially.

First, as shown in FIG. 3, the eight write data items Da1 to Da8 to bewritten in the semiconductor memory 2 are supplied to the errorcorrection circuit 1. The write data items Da1 to Da8 are stored in thetemporary storage circuit 3.

Next, as shown in FIG. 4, the write data items Da1 to Da8 are suppliedto the error-detecting code generation units 41 to 48, respectively. Theerror-detecting code generation units 41 to 48 generate theerror-detecting codes Db1 to Db8 for the write data items Da1 to Da8,respectively. When CRC32 is used as the error-detecting codes, each ofthe error-detecting codes Db1 to Db8 has a size of 32 bits.

The write data item Da1 and the error-detecting code Db1 concatenatedafter the write data item Da1 form first data block D1 that is a unit oferror correction. Similarly, the write data items Da2 to Da8 and theerror-detecting codes Db2 to Db8 concatenated after them form first datablocks D2 to D8. The first data blocks D1 to D8 are stored in thetemporary storage circuit 3. Those skilled in the art already know thedetailed arrangement of the error-detecting code generation units 41 to48, and a description thereof will be omitted. In this embodiment, theerror-detecting code generation units 41 to 48 perform the detectingcode generation operations in parallel. The parallel operations of theerror-detecting code generation units 41 to 48 shorten the processingtime.

Next, as shown in FIG. 5, the first data blocks D1 to D8 are supplied tothe first error-correcting code generation units 61 to 68, respectively.The first error-correcting code generation unit 61 generates, using thefirst data block D1, the first error-correcting code Dc1 for correctingerrors in the first data block D1. The first error-correcting code Dc1is concatenated after the error-detecting code Db1 and before the writedata item Da2 and stored in the temporary storage circuit 3.

Similarly, the first error-correcting code generation units 62 to 68respectively generate, using the first data blocks D2 to D8, the firsterror-correcting codes Dc2 to Dc8 for correcting errors in the firstdata blocks D2 to D8. The first error-correcting code Dc2 isconcatenated after the error-detecting code Db2 and before the writedata item Da3 and stored in the temporary storage circuit 3. Similarly,the first error-correcting codes Dc3 to Dc7 are respectivelyconcatenated after the error-detecting codes Db3 to Db7 and before thewrite data items Da4 to Da8 and stored in the temporary storage circuit3. The first error-correcting code Dc8 is concatenated after theerror-detecting code Db8 and stored in the temporary storage circuit 3.

When the Hamming code is used as the first error-correcting code, eachof the first data blocks D1 to D8 has a size corresponding to write data(4096 bits)+error-detecting code (32 bits). To correct a 1-bit error inthe first data block D1 to D8, each of the first error-correcting codesDc1 to Dc8 has a size of, e.g., 13 bits. Those skilled in the artalready know the detailed arrangement of the first error-correcting codegeneration units 61 to 68, and a description thereof will be omitted. Inthis embodiment, the first error-correcting code generation units 61 to68 perform the correcting code generation operations in parallel. Theparallel operations of the first error-correcting code generation units61 to 68 shorten the processing time.

The first data blocks D1 to D8 are concatenated in order to form asecond data block. The second data block is supplied to the seconderror-correcting code generation unit 8. The second data block is a unitof data to be used by the second error-correcting code generation unitto generate the second error-correcting code. The seconderror-correcting code generation unit 8 generates, using the second datablock, the second error-correcting code Dd for correcting errors in thesecond data block. The second error-correcting code Dd is concatenatedafter the second data block and stored in the temporary storage circuit3.

When the RS code is used as the second error-correcting code, the seconddata block has a size corresponding to write data (4096bits)×8+error-detecting code (32 bits)×8 and corrects a 12-bit error inthe second data block. To correct an error having such a size in thesecond data block, the second error-correcting code Dd has a size of,e.g., 192 bits. Those skilled in the art already know the detailedarrangement of the second error-correcting code generation unit 8, and adescription thereof will be omitted.

The second error-correcting code Dd is concatenated after the seconddata block in the above-described processes, thereby obtaining atransfer data block (the structure in the temporary storage circuit 3 inFIG. 5). The transfer data block is supplied to the semiconductor memory2. The semiconductor memory 2 stores each transfer data block.

[Arrangement of Read System Circuit]

FIG. 6 is a block diagram illustrating the main portion of the errorcorrection circuit 1 associated with data read.

As shown in FIG. 6, the semiconductor memory 2 supplies a signal S1 to afirst error correction unit 11. The signal S1 is formed from a transferdata block (the structure in the temporary storage circuit 3 in FIG. 5).

If the first data blocks D1 to D8 contain errors, the first errorcorrection unit 11 corrects the errors in the first data blocks D1 to D8using the first error-correcting codes Dc1 to Dc8 in the signal S1,respectively, within the bounds of the capability of the first errorcorrection unit 11. More specifically, the first error correction unit11 corrects the errors in the first data block D1 using the firsterror-correcting code Dc1. Similarly, the first error correction unit 11corrects the errors in the first data blocks D2 to D8 using theerror-correcting codes Dc2 to Dc8, respectively, within the bounds ofthe capability of the first error correction unit 11.

The first error correction unit 11 outputs a signal S2 obtained bycorrecting the errors in the signal S1 using the first error-correctingcodes. If the number of error bits in the first data blocks D1 to D8before error correction is equal to or less than the error correctioncapability of the first error correction unit 11, the first data blocksD1 to D8 in the signal S2 after error correction contain no errors.

However, if the number of error bits in the first data blocks D1 to D8before error correction exceeds the error correction capability of thefirst error correction unit 11, the first data blocks D1 to D8 in thesignal S2 after error correction still contain errors.

The signal S2 is supplied to an error detection unit 12 and a seconderror correction unit 13. The error detection unit 12 detects errors inthe write data items Da1 to Da8 using the error-detecting codes Db1 toDb8. The error detection unit 12 directly supplies the signal S2 to aselection unit 14. The error detection unit 12 also supplies, to theselection unit 14, a signal S3 representing the presence/absence oferror detection in all the first data blocks D1 to D8. The errordetection unit 12 supplies, to the second error correction unit 13, asignal S4 containing information representing error detection locationsin the first data blocks D1 to D8 in addition to the presence/absence oferror detection.

The second error correction unit 13 analyzes the signal S4 and acquiresinformation representing whether errors are detected upon errordetection by the error detection unit 12. If no errors are detected,error correction is not necessary any more. For example, the seconderror correction unit 13 stops the operation for the signal S2 of theprocess target as power supply from a power supply circuit (not shown)or clock signal supply from a clock circuit (not shown) stops.

Upon analyzing the signal S4 and acquiring information representing thaterrors are detected in the signal S2, the second error correction unit13 corrects the errors in the first data blocks D1 to D8 using thesecond error-correcting code Dd. At this time, the second errorcorrection unit 13 executes error correction for only the first datablocks Dl to D8 containing errors. FIG. 7 shows an example of thisstate.

FIG. 7 shows an example in which errors are detected in the first datablocks D2, D4, and D5. The second error correction unit 13 executessyndrome calculation using the second error-correcting code Dd for allthe first data blocks D1 to D8. On the other hand, the second errorcorrection unit 13 executes Chien search for only the first data blocksD2, D4, and D5 containing the detected errors. The second errorcorrection unit 13 corrects the errors in the first data blocks D2, D4,and D5 using the second error-correcting code Dd. The second errorcorrection unit 13 outputs a signal S5 obtained by correcting the errorsin the signal S2 using the second error-correcting code.

Error correction by the second error correction unit 13 is sequentiallyexecuted for the errors detected in the first data blocks D1 to D8,unlike the prior art. That is, no error correction circuit dedicated toeach of the first data blocks D1 to D8 is provided. This reduces thecircuit scale and power consumption of the second error correction unit13.

Depending on the number of first data blocks to be subjected to errorcorrection, the necessary time may be longer than in parallel errorcorrection by the dedicated circuits of the first data blocks D1 to D8.In this embodiment, however, the second error correction unit 13executes Chien search for only, of the first data blocks D1 to D8, datablocks containing detected errors. In addition, the firsterror-correcting code is designed to be able to correct most (nearly100%) of the errors in the first data blocks D1 to D8 by only correctionusing the first error-correcting code. For this reason, the seconderror-correcting code is rarely used. In this embodiment, it istherefore possible to reduce the circuit scale and power consumption ofthe second error correction unit 13 without any increase in theprocessing time by sharing the error correction circuit for the firstdata blocks D1 to D8.

Assume that in a process of repeatedly reading certain a transfer datablock from the memory device, the error detection unit 12 detects noerror in the transfer data block which is read for the first time.

In this case, at least one of power supply and clock signal supply tothe second error correction unit 13 is stopped in advance in reading thetransfer data block for the second and subsequent times. This largelyreduces the power consumption in the error correction circuit 1 inreading the same transfer data block.

How to decide the correction capability of the first error correctionunit 11 and that of the error detection unit 12 will be described next.Note that the correction capability of the first error correction unit11 also includes the process of causing the first error-correcting codegeneration units 61 to 68 to generate the first error-correcting codesDc1 to Dc8. Similarly, the correction capability of the second errorcorrection unit 13 also includes the process of causing the seconderror-correcting code generation unit 8 to generate the seconderror-correcting code Dd.

FIG. 8 is a graph illustrating the relationship between the necessarycorrection capability and the elapsed time from data write in thesemiconductor memory 2. As shown in FIG. 8, as the elapsed time becomeslong, the number of errors in the data written in the semiconductormemory 2 increases. The error correction capability is changed inaccordance with the increase in the number of errors. The errorcorrection capability of the first error correction unit 11 and that ofthe second error correction unit 13 are decided so that an excessive orinsufficient error correction capability are used. More specifically,the error correction capability of the first error correction unit 11and that of the second error correction unit 13 are decided such thaterror correction can be done solely by the first error correction unit11 when the elapsed time is short, while the first error correction unit11 and the second error correction unit 13 can execute error correctionwhen the elapsed time exceeds a predetermined time (the time when thenumber of errors abruptly increases).

FIG. 9 shows the concept of the process range of the first errorcorrection unit 11 and that of the second error correction unit 13according to this embodiment. The abscissa in FIG. 9 represents thenumber of errors within a predetermined range (a page of a NAND flashmemory) of the semiconductor memory 2. The ordinate represents the erroroccurrence probability. The broken line indicates the relationshipbefore degradation of the semiconductor memory 2 (immediately afterwrite). The solid line indicates the relationship after degradation ofthe semiconductor memory 2 (after the guaranteed data retention time haselapsed).

As shown in FIG. 9, the error correction capability of the first errorcorrection unit 11 is decided such that only the first error correctionunit 11 can correct all errors when the number of errors within thepredetermined range is small. More specifically, the number ofcorrectable bits, error correction method, and the number of bits of anerror-correcting code are decided. For example, the error correctioncapability of the first error correction unit 11 is decided such that itcan correct almost 100% of errors before degradation and about 99% oferrors after degradation. On the other hand, the error correctioncapability of the second error correction unit 13 is decided to correctthe remaining 1% of errors after degradation.

As a result, the use probability of the second error correction unit 13rises along with the increase in the error rate, as shown in FIG. 10.

As described above, the first error correction unit 11, which has alower error correction capability but requires a shorter processing timeand lower power consumption, corrects almost all errors. The seconderror correction unit 13, which requires a longer processing time andhigher power consumption but has a higher error correction capability,corrects the remaining errors. The error correction circuit 1 cantherefore achieve a short processing time, low power consumption, andsmall circuit scale while maintaining a high error correctioncapability.

FIG. 11 shows the relationship between the error rate and the averagedChien search range of the second error correction unit 13. In thisembodiment (solid line), the error correction capability of the firsterror correction unit 11 is set such that most errors can be correctedby only the first error correction unit 11, as described above. For thisreason, even when the error rate is high, the second error correctionunit 13 is rarely involved in error correction, as compared to the priorart (broken line).

As described above, according to the semiconductor memory device of theembodiment, the plurality of first data blocks D1 to D8 each containinga corresponding one of a plurality of write data items are formed. Theplurality of first error-correcting codes Dc1 to Dc8 are generated forthe plurality of first data blocks D1 to D8, respectively. Additionally,the second error-correcting code Dd is generated for a second data blockformed from the plurality of first data blocks D1 to D8. When the numberof error bits is small, correction is done using the firsterror-correcting codes Dc1 to Dc8 which have a low capability butrequire low power consumption and a small circuit scale. When the numberof error bits is large, correction is done using both the firsterror-correcting codes Dc1 to Dc8 and the second error-correcting codeDd which requires high power consumption and a large circuit scale butallows correction with a high capability. Hence, there is provided asemiconductor memory device whose error correction circuit 1 has anappropriate circuit scale and power consumption and shortens the errorcorrection time without sacrificing the error correction capability.

In this embodiment, error correction using the second error-correctingcode Dd is executed for, of the first data blocks D1 to D8, only datacontaining errors even after error correction using the firsterror-correcting codes Dc1 to Dc8. This can greatly reduce the circuitscale of the second error correction unit 13 as compared to an examplein which circuits for executing error correction using the seconderror-correcting code Dd are provided in correspondence with theplurality of first data blocks D1 to D8.

Additional advantages and modifications will readily occur to thoseskilled in the art. Therefore, the invention in its broader aspects isnot limited to the specific details and representative embodiments shownand described herein. Accordingly, various modifications may be madewithout departing from the spirit or scope of the general inventiveconcept as defined by the appended claims and their equivalents.

1. A storage device comprising: a nonvolatile semiconductor memoryconfigured to store a plurality of detecting codes to respectivelydetect errors in a plurality of data items, a plurality of firstcorrecting codes to respectively correct errors in a plurality of firstdata blocks each of which comprises one of the data items and acorresponding detecting code, a second correcting code to correct errorsin a second data block which comprises the first data blocks, and thesecond data block; a first corrector configured to correct errors in thefirst data blocks using the first correcting codes; a detectorconfigured to detect, using the detecting codes, errors in the dataitems corrected by the first corrector, respectively, and generate firsterror information representing presence/absence of an error in each ofthe corrected data items; and a second corrector configured to correcterrors in, of the corrected data items, a number of data itemscontaining errors using the first error information and the secondcorrecting code.
 2. The device according to claim 1, wherein the secondcorrector stops a correction process when the data items corrected bythe first corrector contain no error.
 3. The device according to claim1, wherein the nonvolatile semiconductor memory is a NAND flash memory.4. A storage device comprising: a first correcting code generatorconfigured to generate a first correcting code to correct error in afirst data block; a second correcting code generator configured togenerate a second correcting code to correct error in a second datablock, the second data block comprising first data blocks; and anonvolatile semiconductor memory configured to store the second datablock, first correcting codes, and the second correcting code, whereinwhen data is read out from the nonvolatile semiconductor memory, a firsterror correction processing is performed first by using the firstcorrecting code, if the first error correction processing isunsuccessful, a second error correction processing is performed by usingthe second correcting code, and if the first error correction processingis successful, the second error correction processing is not performed.5. The device according to claim 4, further comprising: a firstcorrector configured to correct errors in the first data blocks usingthe first correcting codes; and a second corrector configured to correcterrors in the second data block using the second correcting code.
 6. Thedevice according to claim 4, wherein the nonvolatile semiconductormemory is a NAND flash memory.